package com.ljs.accountclient.Controller;

import com.ljs.accountclient.Vo.AccountVo;
import com.ljs.accountclient.feign.AccountFeign;
import com.ljs.accountclient.util.JsonResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class AccountController {
      @Resource
      AccountFeign accountFeign;
      @Value("${server.port}")
      int port;
      @RequestMapping("/client/selall")
      @ResponseBody
      public JsonResult selall(){
            JsonResult jsonResult=new JsonResult();
            List<AccountVo> list=accountFeign.sel();
            list.stream().forEach(AccountVo->{
                  System.out.println(AccountVo);
            });
            jsonResult.setData(list);
          return jsonResult;
      }
      @RequestMapping("/ip")
      @ResponseBody
      public String ip(){
            System.out.println("端口是"+port);
            return "调用成功";

      }

}
